#ifndef WEBRTC_STREAMER_H_3060898B846849FF9F88F5DB59B5950C
#define WEBRTC_STREAMER_H_3060898B846849FF9F88F5DB59B5950C

#ifdef __cplusplus
#include <cstddef>
#include <cstdarg>

extern "C" {
#else
#include <stdarg.h>
#endif




typedef enum {
    WEBRTC_EVENT_NULL             = 0,
    WEBRTC_EVENT_ASK_IFRAME       = 1,
    WEBRTC_EVENT_LUCK             = 2,   //回调值result 返回锁状态   0 开 ，1是关
    WEBRTC_EVENT_UNLUCK           = 3,   //回调值result 返回锁状态   0 开 ，1是关
    WEBRTC_EVENT_LUCK_STATE       = 4,   //回调值result 返回锁状态   0 开 ，1是关
    WEBRTC_EVENT_CALL_START       = 5,
    WEBRTC_EVENT_CALL_LINK        = 6,
    WEBRTC_EVENT_CALL_DISCONNECT  = 7,
    WEBRTC_EVENT_CALL_DESTORY     = 8,
    WEBRTC_EVENT_ONLINE     = 9,
    WEBRTC_EVENT_OFFLINE     = 10,
} webrtc_event_type_t;

typedef enum {
    WEBRTC_CALL_EVENT_DOORBELL_PRESS            = 0,
    WEBRTC_CALL_EVENT_PIR            = 1,
} webrtc_call_event_type_t;

typedef enum {
    WEBRTC_ERR_SUCCESS              = 0,
    WEBRTC_ERR_INITSTRING            = -1,
    WEBRTC_ERR_SERNO               = -2,
} webrtc_error_t;


typedef void(*webrtc_streamer_call_income_callback)(char *sessionId,size_t sessionId_len,void *user);
typedef void(*webrtc_streamer_call_destory_callback)(char *sessionId,size_t sessionId_len,void *user);
typedef void(*webrtc_streamer_event_callback)(webrtc_event_type_t event,void *user,int *result);
typedef void(*webrtc_streamer_audio_callback)(char *data,size_t len,char *sessionId,size_t sessionId_len,void *user);
typedef void(*webrtc_streamer_configuration_callback)(char *data,size_t len,int reboot);

int webrtc_streamer_init(char *initstring,char *configuration,char *serno,char *servers, char *customerserno);

int webrtc_streamer_uninit();
/*
函数说明:
      webrtc_streamer_set_mem_info::
     
      max_sdk_use_mem            max memory use for sdk                                    defualt     10*1024*1024
      max_ssession_use_mem       max memory use for every ssession                         defualt     300*1024
      max_ssession_buffer_size   max memory use for every ssession cache buffer size       defualt     60
 
第一个参数：max_sdk_use_mem 是sdk的总内存限制。超出就会丢弃。
第二个参数：max_ssession_use_mem 每个会话的内存限制，一般300-600K看用户设置的码流。
第三个参数：max_ssession_buffer_size 是视频缓冲RTP网络打包数，用于重传。算法： 缓冲包*1500，这个数。应该比第二个参数小。大概是第二个参数一半，其他用于网络收包和音频包。   
*/
int webrtc_streamer_set_mem_info(int max_sdk_use_mem,int max_ssession_use_mem,int max_ssession_buffer_size);

int webrtc_streamer_register_call_income_callback_fun(webrtc_streamer_call_income_callback callback,void *user);
int webrtc_streamer_register_call_destory_callback_fun(webrtc_streamer_call_destory_callback callback,void *user);
int webrtc_streamer_register_event_callback_fun(webrtc_streamer_event_callback callback,void *user);
int webrtc_streamer_register_audio_callback_fun(webrtc_streamer_audio_callback callback,void *user);
int webrtc_streamer_register_configuration_callback_fun(webrtc_streamer_configuration_callback callback,void *user);
int webrtc_streamer_input_audio_data(unsigned char *data,size_t len);
int webrtc_streamer_input_video_data(unsigned char *data,size_t len);
int webrtc_streamer_event_call(webrtc_call_event_type_t event);
int webrtc_streamer_close_session(char *sessionId,size_t sessionId_len);
int webrtc_streamer_current_session_count();
#ifdef __cplusplus
}
#endif

#endif
